/*
 * Vector2.h
 *
 *  Created on: Jan 21, 2011
 *      Author: Helpful Learn Group
 */

#include <cmath>

#ifndef VECTOR2_H_
#define VECTOR2_H_

/*
 *	Add other methods later
 *	.......
 */


namespace GSP280
{
	class Vector2
	{
	private:
		//DATA MEMBERS...
		float x; //D001: X-coordinate
		float y; //D001: Y-coordinate

	public:
		Vector2(): x(0), y(0) {};								//C001: DEFAULT CONSTRUCTOR
		Vector2(float const X, float const Y) : x(X), y(Y) {};	//C002: OVERLOADED CONSTRUCTOR
		virtual ~Vector2() {};									//C003: DESTRUCTOR

		Vector2( const Vector2 &vect2 );						//C004: COPY CONSTRUCTOR
		Vector2 & operator=( const Vector2 &vect2 );			//C005: ASSIGNMENT OPERATOR
		
		void setVector2( const Vector2 &vect2 );				//M001: Set Location
		void setVector2( const float &_x, const float &_y );	//M002: Set x-value, y-value
		const Vector2 getVector2() const;						//M003: Get Location

		void setX( const float &_x );							//M004: Set x-value
		const float getX() const;								//M005: Get x-value
		void setY( const float &_y );							//M006: Set y-value
		const float getY() const;								//M007: Get y-value


		//OVERLOADED OPERATORS....
		const Vector2 operator +( const Vector2 &r );			//M008: Addition operator
		const Vector2 operator -( const Vector2 &r );			//M009: Subtraction operator
		const Vector2 operator *( const float &scalar );		//M010: Multiplication operator
		const Vector2 operator -() const;						//M011: Convert Location from +ve to -ve

		const Vector2 & operator +=( const Vector2 &r );		//M012: Increment Location by a given vector
		const Vector2 & operator -=( const Vector2 &r );		//M013: Decrement Location by a given vector


		//==================================
		//FUTURE METHODS.....
		//==================================
		/*
		void rotate( const float &angle );
		const float magnitude() const;
		void normalize();
		const float dotProduct( const Vector2 &r ) const;
		const float crossProduct( const Vector2 &r ) const;
		*/

		//Magnitude: sqrt (x^2 + y^2)
		const float magnitude();

		//normal: (1/|A|) * A - 1 divided by magnitude A, multiplied by vector A<x,y>
		Vector2 normalize();

		const float dotProduct(Vector2 const &vec1);
		
		// Cross product between two vectors
		// returns a scalar
		const float crossProduct(const Vector2 &vec1) const;

		// Cross product between two vectors
		// returns a Vector2
		//const Vector2 Vector2::crossProduct(const Vector2 &vec1) const;			// FIX THIS LATER ON

	};//end class
}//end namespace

#endif /* VECTOR2_H_ */
